package com.hjl.service.impl;

import com.hjl.mapper.EmpMapper;
import com.hjl.pojo.Employee;
import com.hjl.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ServivE
 * @version 0.1
 * @className EmployeeServiceImpl
 * @description
 * @date 2024/8/13 21:54
 * @since jdk17
 */
@Service
public class EmployeeServiceImpl implements EmployeeService {
    @Autowired
    private EmpMapper empMapper;

    /**
     * 查询所有员工信息
     */
    @Override
    public List<Employee> findAll() {
        List<Employee> employeeList = empMapper.queryAll();
        return employeeList;
    }

    @Override
    public Employee findEmpById(int id) {
        Employee employee = empMapper.queryEmpById(id);
        return employee;
    }

    @Override
    public int insertInfo(Employee e) {
        int i = empMapper.insertInfo(e);
        return i;
    }

    @Override
    public int deleteInfoById(int id) {
        return empMapper.deleteInfoById(id);
    }

    @Override
    public void updateInfoById(Employee employee){
        empMapper.updateInfoById(employee.getEmpId(), employee.getEmpSalary());
    }
}
